from concurrent.futures import ThreadPoolExecutor, wait

import PyQt5
from PyQt5.QtCore import QObject, pyqtSlot, QMetaObject, Qt, pyqtSignal

import cache

class MainAction(QObject):

    def __init__(self):
        super().__init__()


    @pyqtSlot()
    def readyForData(self):
        executor = ThreadPoolExecutor(max_workers=3)
        tasklist = []
        future = executor.submit(cache.Cache.app.contactObject.pushfriendList)
        tasklist.append(future)
        wait(tasklist)
        executor.shutdown()
        QMetaObject.invokeMethod(cache.Cache.app, 'showMain', PyQt5.QtCore.Qt.QueuedConnection)


